/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.client.domain;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;

/**
 * 
 * @author Gauthier
 */
@Entity
@Table(name="tb_livre")
@NamedQueries({
        @NamedQuery(name="Livre.findBysearch", query="SELECT b FROM Livre b WHERE b.nom LIKE :pattern ")})
public class Livre implements Serializable {
        
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name="ID_livre")
    private Integer  ID_livre;
    
    @Column(name="type")
    private String categorie;
    
    @Column(name="nom")
    private String nom;
    
    @Column(name="stock")
    private Integer stock;
    
    @Column(name="seuil")
    private Integer seuil;
    
    @Column(name="prix")
    private Float prix;
    
    @Column(name="resume")
    private String resume = "Aucun résumé disponnible";
    
    @Column(name="nb_commandes")
    private Integer nbCommandes;
    
    @Column(name="url")
    private String url;
        
    @OneToMany(mappedBy="livre")
    private List<CommandeLivre> commandeList;
    
    @Column(name="ID_auteurs")
    private Integer Auteurs;

    public Livre() {
    
    }

    public Livre(String categorie, String nom, Integer stock, Integer seuil, Float prix, String url, String resume, Integer Auteurs) {
        this.categorie = categorie;
        this.nom = nom;
        this.stock = stock;
        this.seuil = seuil;
        this.prix = prix;
        this.nbCommandes = nbCommandes = 0;
        this.url = url;
        this.Auteurs = Auteurs;
        this.resume = resume;
       }

    public Integer getID_livre() {
        return ID_livre;
    }

    public void setID_livre(Integer ID_livre) {
        this.ID_livre = ID_livre;
    }

    public String getCategorie() {
        return categorie;
    }

    public void setCategorie(String categorie) {
        this.categorie = categorie;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public Integer getSeuil() {
        return seuil;
    }

    public void setSeuil(Integer seuil) {
        this.seuil = seuil;
    }

    public Float getPrix() {
        return prix;
    }

    public void setPrix(Float prix) {
        this.prix = prix;
    }

    public String getResume() {
        return resume;
    }

    public void setResume(String resume) {
        this.resume = resume;
    }

    public Integer getNbCommandes() {
        return nbCommandes;
    }

    public void setNbCommandes(Integer nbCommandes) {
        this.nbCommandes = nbCommandes;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public List<CommandeLivre> getCommandeList() {
        return commandeList;
    }

    public void setCommandeList(List<CommandeLivre> commandeList) {
        this.commandeList = commandeList;
    }

    public Integer getID_Auteurs() {
        return Auteurs;
    }

    public void setID_Auteurs(Integer Auteurs) {
        this.Auteurs = Auteurs;
    }
}



